home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2002 #11
/
Amiga Plus CD - 2002 - No. 11.iso
/
Tools
/
AmigaSystem
/
AmiStart
/
ModulesSDK.lha
/
developer.doc
next >
Wrap
Text File
|
2002-04-27
|
13KB
|
331 lines
Amistart Module Developer Documentation:
This documentation describes how to implement external AmiStart modules, the
AmiStart module developer kit bases on "Lib37x" available on AMINET done by
Andreas R. Kleinert. This means you could spread module-libraries but you can't
spread the sourcecode of them without asking Andreas R. Kleinert for permission
What are Modules?
modules have a library equal structure, all modules with the same Version must
implement all Functions for this Version.
Modules makes able to add Features to AmiStart, like a WindowList Display,
TaskDisplay and much more.
AmiStart calls the defined function to get informations what to display and how to
do this.
You cannot call AmiStart functions!, your module is only a information server and AmiStart is the
client.
How to start?
First think about what version of a Module you really need, see the Version
Module Description below for example if you only need Version 39 Functions
set VERSION in the File LibInit.c to 39 (all modules must at least have
Version 39, coz this is the initial Version). Unsing a Version prevents AmiStart
from calling Functions of upper Versions, but all Functions must be implement
for this Version and all of its parent.
Change the EXLIBNAME, REVISION and Copyright notice in LibInit.c.
Implement all Module Functions for your specific Version in the File ModuleFuncs.c
Finally compile StartUp.c LibInit.c and ModuleFuncs.c link them in this order without
any StartUp Code (library linking) and finnaly link the amiga.lib, name the output
"modulename".module, where modulename is the same name as defined in libInit.c named
EXLIBNAME.
NOTE: i have only tested the makefile for the vbcc compiler and can not give any guarantee that other
makefiles will work.
The resulting module must be copied to modules in the AmiStart Directory, or in a
Directory modules inside the DATAPATH defined by the DATAPATH TOOLTYPE.
How a Module Works.
A Module doesn't have any specific data structures you are free to implement your
data as you need it, all requests will be done by specific Functions with fixed
Parameters and Fixed results, this functions must be implement.
******************************************************************************************
******************************************************************************************
Which Functions must be implement?
Note: Newer Versions must implement previous Version Functions.
Note: a module is library based, so you must make all functions reentrant.
A Function has the following Structure:
RETURNTYPE FunctionName(PAREMETER1, PARAMETER2, ...)
while PARAMETERS are all filled by AmiStart,
******************************************************************************************
Version 39: (initial Version)
APTR OpenModule()
Initial a Module.
INPUTS: none
OUTPUT: APTR, if NULL initialation fails and module will not be used even if the module is loaded.
after quitting AmiStart, this value will be passed to CloseModule even if it is NULL.
This value will not be used by AmiStart, it will only passed to CloseModule(), and tested
against NULL.
Description:
AmiStart calls this command after you start AmiStart, it will be only called once so you
can (but you must not) do some initial/global setup like patches open libs and so on.
Return non-NULL to make sure that AmiStart could use this Module, save allocated data somewhere inside
the returned data struct.
See: CloseModule()
VOID CloseModule(APTR init = REG(a0))
Opposit of OpenModule().
INPUTS: init, returnstatement from OpenModule.
OUTPUT: none
Description:
will be finnaly called once if the User quits AmiStart.
Be sure to make this Function "call save", coz it will be called
even if OpenModule() fails.
Do some cleanup here for example closing libs you have opened in OpenModule().
See: OpenModule()
STRPTR GetModuleInfo()
Get a short info string for this Module.
INPUTS: none
OUTPUT: STRPTR a pointer to a Module Info String.
Description:
AmiStart calls this function to get a short Info Text, don't use newline characters here.
You can use MUI escape sequences.
See: GetModuleDescription()
STRPTR GetModuleDescription()
Get a detailed Module description.
INPUTS: none
OUTPUT: STRPTR a pointer to a Module Description String.
Description:
AmiStart calls this function to get a detailed module description.
use any MUI esc sequenced and you can use linefeeds here.
See: GetModuleInfo()
APTR InitModule(struct RDArgs args = REG(a0), APTR pool = REG(a1))
subinstallation of a module.
INPUTS: rdArgs Pointer to a dos RDArgs structure.
pool A Pointer to a exec memory pool the module could use to prevent memory fragmantation, you could
use AllocVec/AllocMen instead.
Memory flags are MEMF_ANY|MEMF_CLEAR, so you can be sure to get memory filled with zero bytes.
OUTPUT: APTR module specific data,
Description:
Once AmiStart is loaded and a Module is initialized by OpenModule(), AmiStart calls this Function
each time a user hits an entry this module belongs to (not the content of the entry), AmiStart indicates
here that AmiStart want to open A new Window and says i want to ask what i should display.
Displaying most system-structures needs to be read inside a Forbid()/Permit() call, you can
use this Function to get this information.
Return a pointer to a struct or something else, this Data will be used to get Infos what to display and
will be passed to DataRetieving functions.
The rdArgs argument is a dos RDArgs structure which can be used by dos/ReadArgs to parse the user settings string
which could be entered in the item settings window in AmiStart.
Don't use FreeArgs (AmiStart does this) and you can be sure, this Pointer is never NULL.
Note: the rdArgs pointer is only valid in InitModule().
Note: Use dos/ReadArgs() to parse Arguments in a dos like way "SWITCH/S,NUMBER/N=,....", see there.
see the demo source.
you can also generate a list "on the fly" inside the specific functions if it is sure
that other tasks do not destroy infos you want to get.
the whole process for retrieving data done by AmiStart is.
APTR data = InitModule(args, pool);
while(NextModuleData(data)) {
name = getModuleName(data);
...
}
DisposeModule(data, pool);
NOTE: you have to handle return values inside DisposeModule(), NextModuleData() ... AmiStart doesn't use this value
it's only a "identifier" so your module can find out who has asked something.
See: DisposeModule()
void DisposeModule(APTR dat = REG(a0), APTR pool = REG(a1))
opposite of InitModule()
INPUTS: dat return value from InitModule()
pool Pointer to a memory pool, so you can free Memory allocated in InitModule()
Descrption:
cleanup all allocations done by InitModule().
this function will be called after the user closes the Window where moduledata is displayed.
See: InitModule()
BOOL NextModuleData(APTR data = REG(a0))
set pointer
INPUTS: data returnstatement from InitModule()
OUTPUT: BOOL if TRUE new data is available, else AmiStart stops getting more data.
Description:
set a internal module pointer to the next data, so data retrieving functions are able
to return the next data. After InitModule() this function must set the pointer to the first vaild
data, so a simple loop could run through the whole list.
STRPTR GetModuleName(APTR data = REG(a0))
get name of actual item
INPUTS: data returnstatement form InitModule()
OUTPUT: STRPTR String which will be displayed in a AmiStart Layer list.
Description:
After NextModuleData() is called, this function should return the String which
will be displayed in an AmiStart Layer.
Note: data will be duplicated by AmiStart.
See: GetModuleIcon(), GetModuleTool(), GetModuleUserData()
STRPTR GetModuleIcon(APTR data = REG(a0))
get icon of actual item
INPUTS: data returnstatement from InitModule()
OUTPUT: STRPTR name of the Icon to display (leave ".info" extension).
Description:
After NextModuleData() is called, this function should return the Name of the icon which
will be displayed in an AmiStart Layer. Should be modules/"modulename" by default
Note: data will be duplicated by AmiStart.
See: GetModuleName(), GetModuleTool(), GetModuleUserData()
STRPTR GetModuleTool(APTR data = REG(a0))
get something from actual item
INPUTS: data returnstatement form InitModule()
OUTPUT: STRPTR module specific String (not used in V39).
Note: data will be copied by AmiStart
Description:
After NextModuleData() is called this, function should return something or NULL,
not used in V39, so you should!!!! return NULL in Ver. 39.
See: GetModuleIcon(), GetModuleTool(), GetModuleUserData()
ULONG GetModuleUserData(APTR data = REG(a0))
get userdata from actual item
INPUTS: data returnstatement from InitModule()
OUTPUT: ULONG an Item ID, for internal module usage.
Description:
After NextModuleData() is called, this function should return the Item ID which will be
passed to some Functions to identify items which are selected.
See: GetModuleIcon(), GetModuleTool(), GetModuleUserData(), DoModuleCommand(), HitModule()
ULONG DoModuleCommand(APTR data = REG(a0), ULONG userdata = REG(d0))
do a command for item with the ID userdata
INPUTS: data returnstatement from InitModule()
userdata a item identifier
OUTPUT: ULONG 0 = keep window alive, 1 = close window after doing this command
upper Versions could return other VALUES.
Description:
It the user klicks a item with the mouse this Function will be called, for example
a closewindow module could close a selected window here.
you can identify which item is clicked by userdata.
See: HitModule()
void HitModule(APTR data = REG(a0), ULONG userdata = REG(d0))
do a hit command for item with the ID userdata
INPUTS: data returnstatement from InitModule()
userdata a item identifier
OUTPUT: none
Description:
It the user enters the item range with the mouse this Function will be called, for example
a windowtofront module could bring a selected window to front here.
you can identify which item is clicked by userdata.
NOTE:
moving the mouse over a item will not call this function again.
See: DoModuleCommand()
ULONG GetModuleFlags(APTR data = REG(a0))
get Flags for actual item
INPUTS: data returnstatement from InitModule()
OUTPUT: ULONG version 39 Modules should always return 0, others see definitions below
Description:
AmiStart calls this method to retrive flags for actual requested Entry (set by NextModuleData),
in V39 this always should be ZERO, newer versions could have subdir Flags or others.
See: GetSpecialInfo(), GetModuleConfig()
APTR GetSpecialInfo(APTR data = REG(a0))
get special info for actual entry
INPUTS: data returnstatement from InitModule()
OUTPUT: APTR pointer to special info for actual data, should always be NULL in V39
Description:
Flag dependent special info (not used in V39).
See: GetModuleFlags(), GetModuleConfig()
STRPTR GetModuleConfig(APTR data = REG(a0))
get config string for actual entry, not used in V39
INPUTS: data returnstatement from InitModule()
OUTPUT: STRPTR config string for actual entry, should always be NULL in V39
Description:
AmiStart calls this method to get the config string for this entry, this could be used in newer
versions to pass configuration data to other modules, or creating subentrys throught the same module.
See: GetModuleFlags(), GetSpecialInfo()
*************************************************************************************
Version 40: (not yet defined)